{% set urls = [] %}  
{%- for host in groups[rocketmq.group] %}  
{%- set host_vars = hostvars[host] %}  
{%- if broker_role is defined and broker_role == 'SYNC_MASTER' or rocketmq.group == 'rocketmq_dledger' %} 
{%- set ip = host_vars['ansible_ssh_host'] %}
{%- set url = ip ~ ':' ~ rocketmq.namesrv_port %}  
{%- set _ = urls.append(url) %}  
{%- endif %}  
{%- endfor %}

services:
  dashboard:
    image: apacherocketmq/rocketmq-dashboard:latest
    container_name: dashboard
    restart: always
    volumes:
      - /data/rocketmq/dashboard/logs:/root/rocketmq/logs
      - /data/rocketmq/dashboard/data:/tmp/rocketmq-console/data
    ports:
      - 19876:8080
    environment:
      xss: 512k
      xms: 128m
      xmx: 512m
      maxDirectMemorySize: 128m
      metaspaceSize: 64m
      maxMetaspaceSize: 256m
      {% if rocketmq.acl.enable %} 
JAVA_OPTS: "-Drocketmq.namesrv.addr={{ ','.join(urls) }} -Drocketmq.config.loginRequired=true -Drocketmq.config.accessKey={{ rocketmq.acl.access_key }} -Drocketmq.config.secretKey={{ rocketmq.acl.secret_key }}"
      {% else %}
JAVA_OPTS: "-Drocketmq.namesrv.addr={{ ','.join(urls) }} -Drocketmq.config.loginRequired=true"
      {% endif %}

